import matplotlib.pyplot as plt
import numpy as np

SIZE_LEN = 416
ANCHOR = np.array([0.57273, 1.87446, 3.33843, 7.88282, 9.77052, 0.677385, 2.06253, 5.47434, 3.52778, 9.16828])  # ori in code
anchors = ANCHOR.reshape([2, -1]).transpose()
# ANCHOR = np.array([0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828])  # COCO in paper
# anchors = ANCHOR.reshape([-1, 2])
anchors /= 13.
anchors *= SIZE_LEN

w = anchors[:, 0]
h = anchors[:, 1]
x1 = SIZE_LEN / 2 - w / 2
y1 = SIZE_LEN / 2 - h / 2
x2 = SIZE_LEN / 2 + w / 2
y2 = SIZE_LEN / 2 + h / 2

plt.figure(figsize=[6, 6])
plt.plot([x1, x2], [y1, y1])
plt.plot([x1, x2], [y2, y2])
plt.plot([x1, x1], [y1, y2])
plt.plot([x2, x2], [y1, y2])

for i, [x1i, y1i] in enumerate(zip(x1, y1)):
    plt.annotate(f'#{i}', xy=[x1i, y1i])

plt.xlim(0, 416)
plt.ylim(0, 416)
plt.ylim(plt.ylim()[::-1])

plt.show()
